<?php
include "connect.php";
$reg=$_POST['reg'];
$name=$_POST['name'];
$fname=$_POST['fname'];
$gender=$_POST['gender'];
$dob=$_POST['dob'];
$nationality=$_POST['nationality'];
$grp=$_POST['grp'];
$address=$_POST['address'];
$tele=$_POST['tele'];
$foccuption=$_POST['foccuption'];
$campid=$_POST['campid'];
$deptid=$_POST['deptid'];

$date=$_POST['date'];
$religon=$_POST['religon'];
$email=$_POST['email'];
$year=$_POST['year'];
$shift=$_POST['shift'];

$eng=$_POST['eng'];
$chem=$_POST['chem'];
$math=$_POST['math'];
$phy=$_POST['phy'];
$mark=$_POST['marksobtain'];







mysql_query("INSERT INTO student_info (reg_no,name,f_name,gender,dob,nationality,religion,b_group,address,telephone,e_mail,f_occupation,campus_id,dept_id,reg_date,year_id,shift) VALUES ('$reg','$name','$fname','$gender','$dob','$nationality','$religon','$grp','$address','$tele','$email','$foccuption','$campid','$deptid','$date','$year','$shift')");

$nrows = 0;
while(isset($_POST['typ'.$nrows])){
	$typ = $_POST['typ'.$nrows];
	$board = $_POST['board'.$nrows];
	$pyear = $_POST['pyear'.$nrows];
	$tmarks = $_POST['tmarks'.$nrows];
	$markso = $_POST['markso'.$nrows];
	$per = $_POST['per'.$nrows];
	
	

$sql2="INSERT INTO student_academic_history (reg_no,academic_type,board,passing_year,total_marks,obt_marks,percent)
VALUES ('$reg','$typ','$board','$pyear','$tmarks','$markso','$per')";
mysql_query($sql2) or die (mysql_error());
$nrows++;
}

$sql3="INSERT INTO student_secondary_academic (reg_no,eng,chem,math,phy,total_marks)
VALUES ('$reg','$eng','$chem','$math','$phy','$mark')";
mysql_query($sql3) or die (mysql_error());


header("location: student_info_success.php");
?>